//
//  FPWebViewVC.m
//  FinanceProject
//
//  Created by 王建龙 on 2025/8/26.
//

#import "FPWebViewVC.h"
#import <WebKit/WebKit.h>

@interface FPWebViewVC ()<WKNavigationDelegate>
@property (nonatomic, strong) WKWebView *webView;
@end

@implementation FPWebViewVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"审核结果" style:(XYCustomNavigationStyleWhite) hiddenBackBtn:NO];
    // Do any additional setup after loading the view.
}
#pragma mark - 创建UI
- (void)initUI{
    [super initUI];
    self.view.backgroundColor = UIColor.whiteColor;
    self.webView = [[WKWebView alloc] initWithFrame:CGRectMake(0., [UIDevice statusBarHeight], SCREEN_WIDTH, SCREEN_HEIGHT - [UIDevice statusBarHeight])];
    self.webView.navigationDelegate = self;
    self.webView.scrollView.showsVerticalScrollIndicator = NO;
    self.webView.backgroundColor = [UIColor hexColor:@"#F4F6FA"];
    self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [self.view addSubview:self.webView];
    NSURL *url = [NSURL URLWithString:self.strUrl];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
}
- (void)backAction {
    if ([self.webView canGoBack]) {
        [self.webView goBack];
    } else {
        [self.navigationController popViewControllerAnimated:YES];
    }
}
#pragma mark - WKNavigationDelegate
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
    [MBManager showLoading];
}
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
    [MBManager hideLoading];
}
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
    [MBManager hideLoading];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
